<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="s" uri="http://www.springframework.org/tags" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!doctype html>
<html>
  <head>
    
    <link rel="stylesheet" href="<s:url value="/resources"/>/css/innerstyle.css" type="text/css" />
    <link rel="stylesheet" type="text/css" media="screen" href="<s:url value="/resources"/>/css/custom-theme/jquery-ui.custom.min.css" />	
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery-ui.custom.min.js"></script> 
	<script type="text/javascript" src="<s:url value="/resources"/>/js/i18n/jquery.ui.datepicker-zh-CN.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.form.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/json2.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/jquery.validate.min.js"></script>
	<script type="text/javascript" src="<s:url value="/resources"/>/js/messages_zh.js"></script>
	
	<style type="text/css">
html, body {
	margin: 0;			 
	padding: 0;	 
    font-size: 85%;
}
#tab{
	width:99%;	
	padding:0 2px 3px 2px;
	margin:0;
	float:left;
}
#tab h1{
	display:block;
	width:95%;
	height:45px;	
	float:center;
	text-align: center;
	padding-top:5px;
}
#tab h1 span{
	width:250px;
	font:bold 26px/55px Arial, Helvetica, sans-serif;
	color:#fff;
	background-color:#fff;
	display:block;
}
.textbox
{
	width:90px;
	border:#000 1px solid;
}
.textboxs
{
	width:70px;
	border:#000 1px solid;
}
.longtextbox
{
	width:180px;
	border:#000 1px solid;
}
.shorttextbox
{
	width:50px;
	border:#000 1px solid;
}
.shorttextbox1
{
	width:50px;
	border:#000 1px solid;
	background-color:#ddd;
}
.textarea
{
    overflow:auto;	
	border:#000 1px solid;
		
}
.select div {
  border:1px solid #000;
  float: left;
}
label{ display:block; }
fieldset { padding:0; border:0; margin-top:25px; }
label.error {  
        color: red;/*错误信息的颜色*/  
    }  
input.error {  
        border:1px dotted red;/*输入错误的输入框的边框样式*/  
    }		
	
	</style>
	
<script type='text/javascript'>
    
	  var trCount =1;	    
		function changeTab() {		    
		     trCount=Number(trCount); 
		    if(trCount==5) return;
            var dtable = document.getElementById("changdi"); 
            var elTr = dtable.insertRow(-1);            
            var jTd = elTr.insertCell(-1);
            var jzz="<input id=\"shr"+trCount+"\" type=\"text\" name=\"htkz["+trCount+"].shouhdwmc\" class=\"longtextbox\" /><input id=\"shrid"+trCount+"\" type=\"hidden\" name=\"htkz["+trCount+"].shouhdwbm\" />";     
            jTd.innerHTML=jzz;
            var fTd = elTr.insertCell(-1);
            var fw ="<input id=\"fh"+trCount+"\" type=\"text\" name=\"htkz["+trCount+"].fuh\" class=\"shorttextbox\" readonly=\"readonly\" onclick=\"clickPzgg("+trCount+");\"><input type=\"hidden\" id=\"mzbm"+trCount+"\" name=\"htkz["+trCount+"].meizbm\"><input type=\"hidden\" id=\"mzmc"+trCount+"\" name=\"htkz["+trCount+"].meiz\"><input type=\"hidden\" id=\"pzbm"+trCount+"\" name=\"htkz["+trCount+"].pinzbm\"><input type=\"hidden\" id=\"pzmc"+trCount+"\" name=\"htkz["+trCount+"].pinz\">";
            fTd.innerHTML=fw;
            var dTd = elTr.insertCell(-1);
            var dw ="<input id=\"zlzb"+trCount+"\" type=\"text\" class=\"longtextbox\" name=\"htkz["+trCount+"].zhilzb\" /><input type=\"hidden\" id=\"zlzbfz"+trCount+"\" name=\"htkz["+trCount+"].zhilzbfzbm\">";
            dTd.innerHTML=dw;
            var lTd = elTr.insertCell(-1);
            var lw ="<input id=\"jiag"+trCount+"\" type=\"text\" class=\"textbox\" name=\"htkz["+trCount+"].jiag\"  />";
            lTd.innerHTML=lw;
            var aTd = elTr.insertCell(-1);
            var aw ="<input id=\"shul"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].shul\" onclick=\"txtzjl_onblur("+trCount+");\">";
            aTd.innerHTML=aw;
            var bTd = elTr.insertCell(-1);
            var bw ="<input id=\"jan"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml1\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            bTd.innerHTML=bw;
            var eTd = elTr.insertCell(-1);
            var ew ="<input id=\"feb"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml2\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            eTd.innerHTML=ew;
            var gTd = elTr.insertCell(-1);
            var gw ="<input id=\"mar"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml3\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            gTd.innerHTML=gw;
            var hTd = elTr.insertCell(-1);
            var hw ="<input id=\"apr"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml4\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            hTd.innerHTML=hw;
            var iTd = elTr.insertCell(-1);
            var iw ="<input id=\"may"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml5\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            iTd.innerHTML=iw;
            var kTd = elTr.insertCell(-1);
            var kw ="<input id=\"jun"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml6\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            kTd.innerHTML=kw;
            var mTd = elTr.insertCell(-1);
            var mw ="<input id=\"jul"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml7\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            mTd.innerHTML=mw;
            var nTd = elTr.insertCell(-1);
            var nw ="<input id=\"aug"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml8\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            nTd.innerHTML=nw;
            var oTd = elTr.insertCell(-1);
            var ow ="<input id=\"sep"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml9\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            oTd.innerHTML=ow;
            var pTd = elTr.insertCell(-1);
            var pw ="<input id=\"oct"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml10\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            pTd.innerHTML=pw;
            var qTd = elTr.insertCell(-1);
            var qw ="<input id=\"nov"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml11\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            qTd.innerHTML=qw;            
            var sTd = elTr.insertCell(-1);
            var sw ="<input id=\"dec"+trCount+"\" type=\"text\" class=\"shorttextbox\" name=\"htkz["+trCount+"].gml12\" onclick=\"txtyuesl_onblur("+trCount+");\">";
            sTd.innerHTML=sw;
            var cTd = elTr.insertCell(-1);
            var cw ="<a href=\"#\" onclick=\"delTab(this);\"><img src=\"<s:url value="/resources"/>/images/subtract.gif\" align= \"absmiddle\" height=\"15\"  width=\"15\"></a>";
            cTd.innerHTML=cw;
            
            loadShdwData(trCount);            
            trCount++;
           
		}
    function delTab(obj){
     var dtable = document.getElementById("changdi"); 
     var tr = obj.parentNode.parentNode;
      dtable.deleteRow(tr.rowIndex);
    }
    
    function checkHt(v1) {
  var url = "<s:url value="/"/>/common/checkHtlrbh";
  var spanVal="";
  document.getElementById("isRepeat").value="0";
  $.post(url,{hetlrbh:v1},function(data){
            var json = JSON.parse(data);            
            if(json.flag=='1'){
            spanVal="<font color=red >* 企业合同号已存在,请您重新填写</font>";
				document.getElementById("isRepeat").value="1";            
            }
            document.getElementById("htSpan").innerHTML=spanVal;
            });  
 }
    
    function changeTabForHtxs(vvalue){
    $("#hetxsname").val($("#hetxs").find("option:selected").text());
    }
    
    function loadHttk(){

        //alert("1");
       var url = "<s:url value="/"/>/common/loadHttk";
       $.post(url,function(data){       
       var json = eval('(' + data + ')');
       $( "#tkjson").val(data);
       $( "#httk").children().remove();  
       //alert(json);
       var dtable = document.getElementById("httk");
       for(var i=0; i<json.length; i++){
    	 //  alert(json[i]);
       jydzObj=json[i];
       var elTr = dtable.insertRow( -1 );
       var tkTd = elTr.insertCell( -1 );
       var tx ="<span id=\"tkh"+i+"\" >"+jydzObj.xh+"</span>";
       tkTd.innerHTML = tx;
       var idTd = elTr.insertCell( -1 );
       idTd.width="400px";
       var sx ="<span id=\"sx"+i+"\" >"+jydzObj.biaot+"</span>";
       idTd.innerHTML = sx;
       var jfTd = elTr.insertCell(-1);
       var jfyq="<textarea cols=\"142\" rows=\"2\" class=\"textarea\" name=\"neir\">"+jydzObj.neir+"</textarea>";     
       jfTd.innerHTML=jfyq;
       }
       });
    }
    
    function changeTabForHttk(vvalue){ 
       if(vvalue==-1){
       loadHttk();
       }else{         
       var url = "<s:url value="/"/>/common/changeHttk?mbId="+vvalue;
       $.post(url,function(data){
       var json = eval('(' + data + ')');
       $( "#tkjson").val(data);
       $( "#httk").children().remove();       
       var dtable = document.getElementById("httk");
       for(var i=0; i<json.length; i++){
       jydzObj=json[i];
       var elTr = dtable.insertRow( -1 );
       var tkTd = elTr.insertCell( -1 );
       var tx ="<span id=\"tkh"+i+"\" >"+jydzObj.xh+"</span>";
       tkTd.innerHTML = tx;
       var idTd = elTr.insertCell( -1 );
       idTd.width="400px";
       var sx ="<span id=\"sx"+i+"\" >"+jydzObj.biaot+"</span>";
       idTd.innerHTML = sx;
       var jfTd = elTr.insertCell(-1);
       var jfyq="<textarea cols=\"142\" rows=\"2\" class=\"textarea\" name=\"neir\">"+jydzObj.neir+"</textarea>";     
       jfTd.innerHTML=jfyq;
       }
       });
       }
    }
    
    function changeTabForJsdw(vvalue,dwlx){
        var url = "<s:url value="/"/>/common/changeJsdw";
      
        if(dwlx=='1'){
        	 $.post(url,{qiyid:vvalue,qiylx:dwlx},function(data){ 
                 var data = eval('(' + data + ')'); 
                
                     $("#szs").val(data.chumdwjsrdz);
                     $("#sfddbr").val(data.chumdwjsrfddbr);
                     $("#swtdlr").val(data.chumdwjsrwtdlr);
                     $("#sdh").val(data.chumdwjsrdh);
                     $("#scz").val(data.chumdwjsrcz);
                     $("#syb").val(data.chumdwjsryzbm);
                     $("#skhyh").val(data.chumdwjsrkhyh);
                     $("#szh").val(data.chumdwjsrzh);
                     $("#sdjh").val(data.chumdwjsrnsrdjh);
                     $("#cmdwjsrmc").val( $("#chumdwjsrbm").find("option:selected").text()); 
                  
                 }); 
        }else{
        	if(vvalue==document.getElementById("msrid").value){
        		 $("#bzs").val(document.getElementById("zs").value);
                 $("#bfddbr").val(document.getElementById("fddbr").value);
                 $("#bwtdlr").val(document.getElementById("wtdlr").value);
                 $("#bdh").val(document.getElementById("dh").value);
                 $("#bcz").val(document.getElementById("cz").value);
                 $("#byb").val(document.getElementById("yb").value);
                 $("#bkhyh").val(document.getElementById("khyh").value);
                 $("#bzh").val(document.getElementById("zh").value);
                 $("#bdjh").val(document.getElementById("djh").value);
                 $("#msdwjsrmc").val( $("#maisdwjsrbm").find("option:selected").text()); 
        	}else{
        		$.post(url,{qiyid:vvalue,qiylx:dwlx},function(data){ 
                    var data = eval('(' + data + ')'); 
                   
                    $("#bzs").val(data.maisdwjsrdz);
                    $("#bfddbr").val(data.maisdwjsrfddbr);
                    $("#bwtdlr").val(data.maisdwjsrwtdlr);
                    $("#bdh").val(data.maisdwjsrdh);
                    $("#bcz").val(data.maisdwjsrcz);
                    $("#byb").val(data.maisdwjsryzbm);
                    $("#bkhyh").val(data.maisdwjsrkhyh);
                    $("#bzh").val(data.maisdwjsrzh);
                    $("#bdjh").val(data.maisdwjsrnsrdjh);
                    $("#msdwjsrmc").val( $("#maisdwjsrbm").find("option:selected").text()); 
           		 });
        	}
   
    	}
    }
    
    
    
    function changeTabForYyz(){
    $( "#yyzmc").val( $("#yingyz").find("option:selected").text());   
    }
    
   
    
    function changeTabForFhdw(){
    $("#fahdwmc").val($("#fahdwbm").find("option:selected").text());
    }

    
    function changeTabForHyls(){
    $("#hangylsname").val($("#hangy").find("option:selected").text());
    }
    
    function changeTabForJglx(){
    $("#jiaglxmc").val($("#jiaglx").find("option:selected").text());
    }
    
    
    function changeTabForCmr(val){ 
    	var dwbm =${sysuser.orgid};
      var url = "<s:url value="/"/>/common/changeCmr";
      $.post(url,{qiyid:val},function(data){
            var json = eval('(' + data + ')');
            $("#qiymc").val(json[0].danwmc);
            $("#chumdwdz").val(json[0].zhus);
            $("#chumdwfddbr").val(json[0].faddbr);
            $("#chumdwwtdlr").val(json[0].weitdlr);
            $("#chumdwdh").val(json[0].dianh);
            $("#chumdwcz").val(json[0].chuanz);
            $("#chumdwyzbm").val(json[0].youzbm);
            $("#chumdwkhyh").val(json[0].kaihyh);
            $("#chumdwzh").val(json[0].yinhzh);
            $("#chumdwnsrdjh").val(json[0].nasrdjh);
            $("#cmrmc").val(json[0].danwmc);
            if(dwbm==val){
            $("#cmrlx").val('1');
            }else{
            $("#cmrlx").val('2');
            }
            });
      }      
   
    /* //本月以及下月
    function loadMonthCss(vvalue){
    var cDate=$("#cDate").val();
    sDate = cDate.substring(5,7);
    var myyear = cDate.substring(0,4); 
       recoverCSs($("#jan0"));
       recoverCSs($("#feb0"));
       recoverCSs($("#mar0"));
       recoverCSs($("#apr0"));
       recoverCSs($("#may0"));
       recoverCSs($("#jun0"));
       recoverCSs($("#jul0"));
       recoverCSs($("#aug0"));
       recoverCSs($("#sep0"));
       recoverCSs($("#oct0"));
       recoverCSs($("#nov0"));
       recoverCSs($("#dec0")); 
    if(vvalue == myyear) 
    {
         if(sDate=='01'){
		  replaseCss($("#jan0"));
		  replaseCss($("#feb0"));
		  }
		  if(sDate=='02'){
		  replaseCss($("#feb0"));
		  replaseCss($("#mar0"));
		  }
		  if(sDate=='03'){
		  replaseCss($("#mar0"));
		  replaseCss($("#apr0"));
		  }
		  if(sDate=='04'){
		  replaseCss($("#apr0"));
		  replaseCss($("#may0"));
		  }
		  if(sDate=='05'){    
		  replaseCss($("#may0"));
		  replaseCss($("#jun0"));
		  }
		  if(sDate=='06'){
		  replaseCss($("#jun0"));
		  replaseCss($("#jul0"));
		  }
		  if(sDate=='07'){
		  replaseCss($("#jul0"));
		  replaseCss($("#aug0"));
		  }
		  if(sDate=='08'){
		  replaseCss($("#aug0"));
		  replaseCss($("#sep0"));
		  }
		  if(sDate=='09'){
		  replaseCss($("#sep0"));
		  replaseCss($("#oct0"));
		  }
		  if(sDate=='10'){
		  replaseCss($("#oct0"));
		  replaseCss($("#nov0"));
		  }
		  if(sDate=='11'){
		  replaseCss($("#nov0"));
		  replaseCss($("#dec0"));
		  }
		  if(sDate=='12'){
		   replaseCss($("#dec0"));
		  }   
    
    }
    if(vvalue > myyear) 
    { 
       if(sDate=='12'){
		  replaseCss($("#jan0"));
		  }
    }
    } */
    
     function loadMonthCss(vvalue){
    var cDate=$("#cDate").val();
    sDate = cDate.substring(5,7);
    var myyear = cDate.substring(0,4); 
       replaseCss($("#jan0"));
       replaseCss($("#feb0"));
       replaseCss($("#mar0"));
       replaseCss($("#apr0"));
       replaseCss($("#may0"));
       replaseCss($("#jun0"));
       replaseCss($("#jul0"));
       replaseCss($("#aug0"));
       replaseCss($("#sep0"));
       replaseCss($("#oct0"));
       replaseCss($("#nov0"));
       replaseCss($("#dec0")); 
    if(vvalue == myyear) 
    {
         if(sDate=='01'){
                   
		  }
		  if(sDate=='02'){
		         recoverCSs($("#jan0"));
		  }
		  if(sDate=='03'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		  }
		  if(sDate=='04'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		  }
		  if(sDate=='05'){    
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		  }
		  if(sDate=='06'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		  }
		  if(sDate=='07'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		  }
		  if(sDate=='08'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		       recoverCSs($("#jul0"));
		  }
		  if(sDate=='09'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		       recoverCSs($("#jul0"));
		       recoverCSs($("#aug0"));
		  }
		  if(sDate=='10'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		       recoverCSs($("#jul0"));
		       recoverCSs($("#aug0"));
		       recoverCSs($("#sep0"));
		  }
		  if(sDate=='11'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		       recoverCSs($("#jul0"));
		       recoverCSs($("#aug0"));
		       recoverCSs($("#sep0"));
		       recoverCSs($("#oct0"));
		  }
		  if(sDate=='12'){
		       recoverCSs($("#jan0"));
		       recoverCSs($("#feb0"));
		       recoverCSs($("#mar0"));
		       recoverCSs($("#apr0"));
		       recoverCSs($("#may0"));
		       recoverCSs($("#jun0"));
		       recoverCSs($("#jul0"));
		       recoverCSs($("#aug0"));
		       recoverCSs($("#sep0"));
		       recoverCSs($("#oct0"));
		       recoverCSs($("#nov0"));
		  }   
    
    }
    if(vvalue > myyear) 
    { 
       if(sDate=='12'){
		  replaseCss($("#jan0"));
		  }
    }
    } 
    
    function replaseCss(d){    
    d.removeClass("shorttextbox1");
    d.addClass("shorttextbox");
    d.removeAttr("readonly");
    }
    
    function recoverCSs(d){
    d.val("");
    d.removeClass("shorttextbox");
    d.addClass("shorttextbox1");
    d.attr("readonly","readonly"); 
    }
    
    function loadCmrJsdwForCombox(){
        var url = "<s:url value="/"/>/common/loadJsdw";
       $.post(url,function(data){
            var json = eval('(' + data + ')'); 
            for(var i=0;i<json.length;i++){            
            $("#chumdwjsrbm").append("<option value='"+json[i].sysid+"'>"+json[i].mingch+"</option>");
            }
            });
    }
    
    function loadCmrData(){
        var url = "<s:url value="/"/>/common/loadCmr";       
        $.post(url,function(data){
            var json = eval('(' + data + ')');            
            $("#cmrbm").empty();
            if(json.length>0){
            $("#cmrbm").append("<option value="+json[0].chumdwbm+" seleted>"+json[0].chumdwmc+"</option>");      
        $("#cmrmc").val(json[0].chumdwmc);
        $("#qiymc").val(json[0].chumdwmc);
        $("#chumdwdz").val(json[0].chumdwdz);
        $("#chumdwfddbr").val(json[0].chumdwfddbr);
        $("#chumdwwtdlr").val(json[0].chumdwwtdlr);
        $("#chumdwdh").val(json[0].chumdwdh);
        $("#chumdwcz").val(json[0].chumdwcz);
        $("#chumdwyzbm").val(json[0].chumdwyzbm);
        $("#chumdwkhyh").val(json[0].chumdwkhyh);
        $("#chumdwzh").val(json[0].chumdwzh);
        $("#chumdwnsrdjh").val(json[0].chumdwnsrdjh);
        
        for(var i=1;i<json.length;i++){
        //alert(projects[i].name);
        $("#cmrbm").append("<option value='"+json[i].chumdwbm+"'>"+json[i].chumdwmc+"</option>");
        }
        }        
        //$("#fahdwmc").val('${jydw.qiyqc}');
        //$("#fahdwbm").val('${jydw.qiyid}');
        $("#szs").val('${jydw.tongxdz}');
        $("#sfddbr").val('${jydw.faddbr}');
        $("#swtdlr").val('${jydw.lianxr}');
        $("#sdh").val('${jydw.qiydh}');
        $("#scz").val('${jydw.qiycz}');
        $("#syb").val('${jydw.qiyyb}');
        $("#skhyh").val('${jydw.kaihyhjbh}');
        $("#szh").val('${jydw.yinghzhjbh}');
        $("#sdjh").val('${jydw.shuiwdjzhgs}');
        });
    }
    
    function loadMsrData(){
      var url = "<s:url value="/"/>/common/loadMsrForAuto2";          
      $.post(url,{qiyid:${toinfo.aotraderid}},function(data){ 
        var projects = eval('(' + data + ')'); 		
        
        var m=projects[0];
        $("#maisdwjsrbm").empty(); 
        $("#maisdwjsrbm").append("<option value="+m.value+">"+m.label+"</option>");      

		$( "#msr" ).val( m.label );
		$( "#msrid" ).val( m.maisdwbm );							
		$( "#maisr").val( m.label );
		$( "#zs").val( m.maisdwdz );
		$( "#fddbr" ).val( m.maisdwfddbr );	
		$( "#wtdlr" ).val( m.maisdwwtdlr );	
		$("#dh").val(m.maisdwdh);	
		$("#cz").val(m.maisdwcz);	
		$("#yb").val(m.maisdwyzbm);	
		$("#khyh").val(m.maisdwkhyh);	
		$("#zh").val(m.maisdwzh);	
		$("#djh").val(m.maisdwnsrdjh);	
		$("#msrssdwbm").val(m.maisdwbm);
		$("#msrssdwmc").val(m.label);
		
		$("#msrssdwbm").val(m.maisdwbm);
		$("#msrssdwmc").val(m.label);
		
		$("#maisdwjsrbm").val(m.maisdwbm);
		$("#msdwjsrmc").val(m.label);
		$("#bzs").val(m.maisdwdz);
		$("#bfddbr").val(m.maisdwfddbr);
		$("#bwtdlr").val(m.maisdwwtdlr);
		$("#bdh").val(m.maisdwdh);
		$("#bcz").val(m.maisdwcz);
		$("#byb").val(m.maisdwyzbm);
		$("#bkhyh").val(m.maisdwkhyh);
		$("#bzh").val(m.maisdwzh);
		$("#bdjh").val(m.maisdwnsrdjh);
		$("#msridwithmc").val(m.value+m.label);
				
		return false;	
    });
    }
    
    function loadFhdwData(){
      // var url = "<s:url value="/"/>/common/loadFhdw";    
      //$.post(url,function(data){ 
       // var projects = eval('(' + data + ')'); 
        //alert(projects);
       $( "#fahdwmc").autocomplete({
			minLength:2,
			source:function( request, response ) {  
                $.ajax({  
                    url: "<s:url value="/"/>/common/loadFhdw2",  
                    dataType: "json",  
                    data: {  
                        q: request.term  
                    },  
                    success: function( data ) {  

                    
                        response( $.map( data, function( item ) {  
                            return {  
                                label: item.label,  
                                value: item.value  
                            }  
                        }));  
                       
                    }  
                });  
            },			
            select: function( event, ui ) {
            //alert(ui.item.label);	
				$( "#fahdwmc").val( ui.item.label );							
				$( "#fahdwbm").val( ui.item.value );						
				return false;

			}
		});
    //});
    }
  //加载市信息
    function changForCity(value){ 
         $.getJSON("<s:url value="/cxtj"/>/changForCity", {province:value}, function(data){
                 //console.log(data[0]);
                 // var ret = eval('(' + data[0] + ')'); 
                 //console.log(ret);
                 //alert(data[1].regionname); 
                  $("#city").empty();
                  $("#city").append("<option value='-1' selected>==请选择==</option>");
		          for(var i=0;i<data.length;i++){
			        sObj = data[i];
			        $("#city").append("<option value='"+sObj.regioncode+"'>"+sObj.regionname+"</option>");
		           } 
          }); 
       }
  
    function loadShdwData(i){
    //var url = "<s:url value="/"/>/common/loadShdw";    
     // $.post(url,function(data){ 
     //   var projects = eval('(' + data + ')'); 
        //alert(projects);
       $( "#shr"+i).autocomplete({
			minLength:2,
			source:function( request, response ) {  
                $.ajax({  
                    url: "<s:url value="/"/>/common/loadShdw2",  
                    dataType: "json",  
                    data: {  
                        q2: request.term  
                    },  
                    success: function( data ) {  

                    
                        response( $.map( data, function( item ) {  
                            return {  
                                label: item.label,  
                                value: item.value  
                            }  
                        }));  
                       
                    }  
                });  
            },				
            select: function( event, ui ) {
            //alert(ui.item.label);	
				$( "#shr"+i ).val( ui.item.label );							
				$( "#shrid"+i ).val( ui.item.value );						
				return false;

			}
		});
    //});
    }
    function loadZlzbWithToid(){
        var toid = '${toinfo.commodityid}';
        //alert(toid);
        var zlzbdata="";
        var url = '<s:url value="/"/>/common/loadZlzbWithToid';       
        $.post(url,{toid:toid},function(data){                 
        $("#zbAry").val(data);
        var json = eval('(' + data + ')'); 
        //alert(json);
       	  if(json.length>0){
       		for(var i=0;i<json.length;i++){ 
                if(json[i].zhibid!=null){
                	 var zhibmc=json[i].zhibmc;
                     var xiaxz=json[i].xiaxz;
                     var fuh=json[i].fuh;
                     var shangxz=json[i].shangxz;
                     var danw=json[i].danw;
                     zlzbdata=zlzbdata+zhibmc+xiaxz+fuh+shangxz+danw+";";
                }
               
               } 
       		
       	  }
       	  //alert(zlzbdata);
       	 $("#zlzb0").val(zlzbdata);
        });
        
        	
        
    }
    
    
    
    $(function(){    

        var cDate=$("#cDate").val();
        var myyear = cDate.substring(0,4);    
        loadMonthCss(myyear);
        loadCmrData(); 
        loadMsrData();
        loadFhdwData();
        loadCmrJsdwForCombox();
        loadHttk();
        //checkZgdw();
        loadShdwData(0);
        loadZlzbWithToid();
        //$("#jsdnr").hide();                 
        $("#but1").button();
        $("#but2").button();
        $("#but3").button();
        
        $( "#datepicker" ).datepicker($.datepicker.regional[ "zh-CN" ]);   
        $( "#kssj" ).datepicker($.datepicker.regional[ "zh-CN" ]);
        $( "#jssj" ).datepicker($.datepicker.regional[ "zh-CN" ]);     
		$( "#pzgg" ).dialog({
		    autoOpen: false,
		    modal: true
		   }); 
		tj();   
		
		//$( document ).tooltip();
		$( document ).tooltip({
      position: {
        my: "left top",
        at: "right top",
        using: function( position, feedback ) {
        $( this ).css( position );
          $( "<div>" )
            .addClass( "arrow" )
            .addClass( feedback.vertical )
            .addClass( feedback.horizontal )
            .appendTo( this );
        }
      }

       });
       
       $("#but1").click(function(){
		    if($("#form1").valid()){
		       var kssj =$("#kssj").val();
		       var jssj =$("#jssj").val();		       		       
		       var cDate=$("#cDate").val();
               var cNf = cDate.substring(0,4);              
               var nf = $("#nianf").val();               
		       var eDate =$("#eDate").val();
		       var flag = true;
		       var msg = "";
		       if(document.getElementById("chumdwjsrbm").value==""){
		           msg ="请定制后选择出卖人结算单位";
		           flag = false;
		        }
		       if(document.getElementById("msrid").value==""){
		           msg ="请选择买受人";
		           flag = false;
		        }
		        if(document.getElementById("fahdwbm").value==""){
		           msg ="请选择发货单位";
		           flag =  false;
		        }
		        if(document.getElementById("shrid0").value==""){
		           msg ="请选择收货单位";
		           flag =  false;
		        }	
		        if(document.getElementById("zlzb0").value==""){
		           msg = "请录入质量指标";
		           flag =  false;
		        }	        
		        if(document.getElementById("mzbm0").value=="-1"){
		           msg ="请点击品种规格后选择煤种";
		           flag =  false;
		        }
		        if(document.getElementById("pzbm0").value=="-1"){
		           msg ="请点击品种规格后选择品种";
		           flag =  false;
		        }
		        
		        if(document.getElementById("fazbm").value==""){
		           msg = "请选择发站";
		           flag =  false;
		        }
		        if(document.getElementById("daozbm").value=="-1"){
		           msg = "请选择到站";
		           flag =  false;
		        }
		        if(nf==cNf){
		            if(comptime(cDate,kssj)){
		               msg ="合同有效期:起始日期不能小于当天";
		               flag =  false;
		            }
		            if(comptime(jssj,eDate)){
		               msg ="合同有效期:结束日期不能大于下月末最后一天";
		               flag =  false;
		            }
		        }
		        
		        if(comptime(kssj,jssj)){
		           msg ="合同有效期:结束日期必须大于起始日期";
		           flag =  false;
		        }
		        if(parseFloat(document.getElementById("shul0").value)!=parseFloat(GetYueZJ())){
		          msg ="报单总数量和分月数量不等,请重新填写";
		          flag = false;
		        }
		        if(document.getElementById("isRepeat").value=="1"){
		          msg = "企业合同号已存在,请重新填写";
		          flag = false;
		        }
		        if(document.getElementById("isZgdw").value=="1"){
		          msg = "主管单位不存在或主管单位不符合要求";
		          flag = false;
		        }
		        if(document.getElementById("msridwithmc").value!=(document.getElementById("msrid").value+document.getElementById("msr").value)){
		          msg = "买受人名称不符合要求";
		          flag = false;
		        }
		        
		        if(flag){
		        var url = "<s:url value="/"/>/htgl/saveNdbd";
		        //alert(url);
		         $("#form1").ajaxSubmit({
		              url:url,
		              type:'post',
		              success:function(data){
		              var json =eval('(' + data + ')');
					    if(json.result==1){
					    alert("起草成功！请到“协商中的合同”发起协商。");
					    window.returnValue=1;
                        window.close();					   
					   }else{
					    alert("保存失败！");
					    //window.returnValue=1;
                        //window.close();
					   }
		              }
		         });	
		        }else{
		          alert(msg);
		        }
		        	       
		        
		        }
		       });
		       
		    $("#but2").click(function(){
		    if($("#form1").valid()){
		       var kssj =document.getElementById("kssj").value;
		       var jssj =document.getElementById("jssj").value;		       
		       var cDate=$("#cDate").val();
		       var eDate =$("#eDate").val();
		       var cNf = cDate.substring(0,4);              
               var nf = $("#nianf").val();   
		       var flag = true;
		       var msg = "";	
		       if(document.getElementById("chumdwjsrbm").value==""){
		           msg ="请定制后选择出卖人结算单位";
		           flag = false;
		        }
		       if(document.getElementById("msrid").value==""){
		           msg ="请选择买受人";
		           flag = false;
		        }
		        if(document.getElementById("fahdwbm").value==""){
		           msg ="请选择发货单位";
		           flag =  false;
		        }
		        if(document.getElementById("shrid0").value==""){
		           msg ="请选择收货单位";
		           flag =  false;
		        }	
		        if(document.getElementById("zlzb0").value==""){
		           msg = "请录入质量指标";
		           flag =  false;
		        }	        
		        if(document.getElementById("mzbm0").value=="-1"){
		           msg ="请点击品种规格后选择煤种";
		           flag =  false;
		        }
		        if(document.getElementById("pzbm0").value=="-1"){
		           msg ="请点击品种规格后选择品种";
		           flag =  false;
		        }
		        if(document.getElementById("fazbm").value==""){
		           msg = "请选择发站";
		           flag =  false;
		        }
		        if(document.getElementById("daozbm").value=="-1"){
		           msg = "请选择到站";
		           flag =  false;
		        }
		        if(nf==cNf){
		            if(comptime(cDate,kssj)){
		               msg ="合同有效期:起始日期不能小于当天";
		               flag =  false;
		            }
		            if(comptime(jssj,eDate)){
		               msg ="合同有效期:结束日期不能大于下月末最后一天";
		               flag =  false;
		            }
		        }
		        
		        if(comptime(kssj,jssj)){
		           msg ="合同有效期:结束日期必须大于起始日期";
		           flag =  false;
		        }
		        
		        if(parseFloat(document.getElementById("shul0").value)!=parseFloat(GetYueZJ())){
		          msg ="报单总数量和分月数量不等,请重新填写";
		          flag = false;
		        }
		        if(document.getElementById("isRepeat").value=="1"){
		          msg = "企业合同号已存在,请重新填写";
		          flag = false;
		        }
		        if(document.getElementById("isZgdw").value=="1"){
		          msg = "主管单位不存在或主管单位不符合要求";
		          flag = false;
		        }
		        if(document.getElementById("msridwithmc").value!=(document.getElementById("msrid").value+document.getElementById("msr").value)){
		          msg = "买受人名称不符合要求";
		          flag = false;
		        }
		        
		        if(flag){
		       var url = "<s:url value="/"/>/htgl/saveAndSubmitDsht";
		         $("#form1").ajaxSubmit({
		              url:url,
		              type:'post',
		              success:function(data){
		              var json =eval('(' + data + ')');
					    if(json.result==1){
					    alert("提报成功！请到【合同电子签章】进行签章操作。");
					    window.returnValue=1;
                        window.close();					   
					   }else{
					    alert("保存失败！");
					    //window.returnValue=1;
                        //window.close();
					   }
		              }
		         });	
		        }else{
		          alert(msg);
		        }
		        	       
		        
		        }
		       });
    });
    

	
	function tj(){		
	/**  
     * 自定义验证规则——增加对select的验证  
     */  
    $.validator.addMethod(    
        "selectNone", 
        function(value, element)
        {   
            if (value == "-1") 
            {    
                return false;    
            }    
            else    
            {   
                return true;    
            }   
        },    
        "必须选择一项" 
    );   
	
	$("#form1").validate({
	       rules: {
	       "iszcx":{
	       selectNone:true
	       },
	       //"ht.hetlrbh": "required",
	       "maisdwmc":"required",
	       "daozmc":"required",
	       "shouhdwmc":"required", 
	       "pinzgg":"required",
	       "fahdwmc":"required",
	       maisr:"required",
	       "jiaglx":{
		       selectNone:true
		   },
	       "chumdwbm":{
	       selectNone:true
	       },
	       "hetxs":{
	       selectNone:true
	       },
	       "fazmc":{
	       selectNone:true
	       },
	       "daozmc":{
	       selectNone:true
	       },
	       "fahdwbm":{
	       selectNone:true
	       },
	       "hangy":{
	       selectNone:true
	       },
	       "chumdwjsrbm":{
	       selectNone:true
	       },
	       "maisdwjsrbm":{
	       selectNone:true
	       },	
	       "daodssd":{
		       selectNone:true
		    },
	       "shul":{
	       required: true, 
	       digits:true,
	       range:[0,9999999]
	       },      
	       "jiag":{
	        required: true, 
	        number:true,
	        range:[0,3000]
	       }
	       },
		   messages: {
			"jiaglx":"请选择价格类型",
		   "chumdwbm":"请选择出卖人",
		   //"ht.hetlrbh":"请输入合同号",
		   "iszcx":"请选择是否为中长期",
		   "maisdwmc":"请选择买受人",
		   "maisr":"请选择买受人",
		   "fazmc":"请选择发站",
		   "daozmc":"请选择到站",
		   "hetxs":"请选择合同形式",
	       "fahdwmc":"请选择发货单位",
	       "hangy":"请选择隶属行业",
	       "chumdwjsrbm":"请选择出卖人结算单位",
	       "maisdwjsrbm":"请选择买受人结算单位",	       
		   "shouhdwmc":"请选择收货单位",
		   "pinzgg":"请选择品种规格",
		   "daodssd":"请选择到达省市",
		   "shul":{
	       required: "请输入数量", 
	       digits:"请输入整数",
	       range:jQuery.validator.format("请输入一千万吨之内的数")
	       },
		   "jiag":{
		    required:"请输入价格",
		    number:"请输入合法数字",
		    range:jQuery.validator.format("请输入0和3000之间的数")
		   }
		   
		   }
		   });
		   
		   
	     
	}
	
	
		
		
	
	function txtzjl_onblur(i) { 
	     if ($("#shul"+i).val() != "") {
	    	 //alert("1");
	            var myDate = new Date();
	            var yf = myDate.getMonth()+1;
                var zjsl = parseFloat($("#shul"+i).val());
                var yuesl = zjsl / (12-yf+1);
                var intyue = parseInt(yuesl);
                var syysl = intyue * (11-yf+1);
                var srysl = zjsl - syysl;
                SetYueZJ(i,intyue, srysl);
                return;
            }
            SetYueZJ(i,0, 0); 
	     
            
        }

        function SetYueZJ(i,yuesl, srysl) {
        	
            if(yuesl==0){
            $("#shul"+i).val(yuesl)
            }
            var myDate = new Date();
            var yf=myDate.getMonth()+1;            
            for (var j=1;j<13;j++){
            if(j>=yf){
      	      $("input[name='gml"+j+"']").val(yuesl) ;
      	      }
            }            
            $("#dec"+i).val(srysl);            
        }  
        
     function txtyuesl_onblur(i) {            
            
            var temp = GetYueZJ(i);
            if (isNaN(temp)) {
                $("#shul"+i).val(0);                
            }
            else {
                $("#shul"+i).val(temp);                
            }

        }

        function GetYueZJ(i) {                  
            var yue1 =parseFloat($("#jan0").val()==''?0:$("#jan0").val());            
            var yue2 = parseFloat($("#feb0").val()==''?0:$("#feb0").val());
            var yue3 = parseFloat($("#mar0").val()==''?0:$("#mar0").val());
            var yue4 = parseFloat($("#apr0").val()==''?0:$("#apr0").val());
            var yue5 = parseFloat($("#may0").val()==''?0:$("#may0").val());
            var yue6 = parseFloat($("#jun0").val()==''?0:$("#jun0").val());
            var yue7 = parseFloat($("#jul0").val()==''?0:$("#jul0").val());
            var yue8 = parseFloat($("#aug0").val()==''?0:$("#aug0").val());
            var yue9 = parseFloat($("#sep0").val()==''?0:$("#sep0").val());
            var yue10 = parseFloat($("#oct0").val()==''?0:$("#oct0").val());
            var yue11 = parseFloat($("#nov0").val()==''?0:$("#nov0").val());
            var yue12 = parseFloat($("#dec0").val()==''?0:$("#dec0").val()); 

            var yuezj = yue1 + yue2 + yue3 + yue4 + yue5 + yue6 + yue7 + yue8 + yue9 + yue10 + yue11 + yue12;            
            return yuezj;
        }
     
     function jsdxxHide(){
     $("#jsdnr1").hide();
     $("#jsdnr").show();
        $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        }); 
        $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'none';    
          }   
        });   
     }  
     
     function jsdxxShow(){
     $("#jsdnr").hide();
     $("#jsdnr1").show();
     $.each($("#bjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       }); 
       $.each($("#bjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     $.each($("#sjsdnr1 tr"), function(i){     
         if(i > 0){        
           this.style.display = 'block';    
         }   
       });
     } 
     
     function comptime(time1, time2) {
        var d1 = new Date(time1.replace(/-/g, "/"));
        var d2 = new Date(time2.replace(/-/g, "/"));
        if(Date.parse(d1) - Date.parse(d2) > 0)
                return true;
        else
                return false;
}

function checkZgdw(){    
    var dwbm =${sysuser.orgid};
    var url = "htgl/isZgdwJqgrid.action?dwbm="+dwbm;
      $.post(url,function(data){
            var json = eval('(' + data + ')');
            //alert(json.result);
            if(json.result==0){
              document.getElementById("isZgdw").value="1";
            }
            });
}


 
     function changeTabForYxq(vvalue){
       if(vvalue==2013){
       $( "#kssj").val("2013-01-01");
       $( "#jssj").val("2013-12-31");
       }
       else if(vvalue==2014){
       $( "#kssj").val("2014-01-01");
       $( "#jssj").val("2014-12-31");
       }
       else if(vvalue==2015){
       $( "#kssj").val("2015-01-01");
       $( "#jssj").val("2015-12-31");
       }
       loadMonthCss(vvalue);
    }
    
    function clickPzgg(i){
     openwindow('findZlzbView','500','700');
    }
    
    function clickFaz(){
     openwindow('findFazView2','300','400');
    }
    
    function clickDaoz(){
     openwindow('findDaozView2','300','400');
    }
    
    function openwindow(url,sheight,swidth){
       var winoption ="dialogHeight:"+sheight+"px;dialogWidth:"+ swidth +"px;status:yes;scroll:yes;resizable:yes;center:yes";
       window.showModalDialog(url,window,winoption);
    }
	
	</script>

  </head>
  
  <body>

<div id="tab">
<p><img src="<s:url value="/resources"/>/img/htlc.gif" width="1200" height="30"></p>
<h1>煤炭交易合同</h1>
<form name="form1" id="form1">
<input type="hidden" name="pouserid" id="pouserid" value="${toinfo.pouserid}"> 
<input type="hidden" name="pousername" id="pousername" value="${toinfo.username}"> 
<input type="hidden" name="authtoken" id="authtoken" value="${authtoken}"> 
<table id="list_search" cellpadding="0" cellspacing="0" border="0">
        <tr>
        	<td> 
            	出卖人（销方）:<span style="color: red;font-size:16px;vertical-align:middle;">*</span> 
            </td>
            <td>
            <div class="select"><div>
            	<select id="cmrbm" name="chumdwbm" style="width:180px;" onchange="changeTabForCmr(this.value)" >
            	
            	</select>            	
            	</div></div>
            <input type="hidden"  name="toid" value="${toinfo.toid}">
            <input type="hidden" name="chumdwmc" id="cmrmc" >
            <input type="hidden" name="chumrlx" id="cmrlx" value="1">
            <input type="hidden" name="chumrssdwmc" value="${jydw.qiyqc}">
            <input type="hidden" name="chumrssdwbm" value="${jydw.qiydm}">
            
            </td>
            <td>企业合同号:</td>
            <td>
            <input id="hetlrbh" type="text" name="hetlrbh" class="longtextbox" onblur="checkHt(this.value)"/>
            <span id="htSpan" ></span>
            <input type="hidden" id="isRepeat" value="0">
            <input type="hidden" id="isZgdw" value="0">
            </td>
            <td>  
                                             发站:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>  
            </td>
            <td>
            	<input id="fazmc" type="text" name="fazmch" class="longtextbox" onclick="clickFaz();" readonly="true"/>
                <input type="hidden" id="fazbm" name="fazbm">
                <input type="hidden" id="xianzkid1" name="xianzkid1">
                <input type="hidden" id="xianzkmc1" name="xianzkmc1">
                <input type="hidden" id="xianzkid2" name="xianzkid2">
                <input type="hidden" id="xianzkmc2" name="xianzkmc2">
                <input type="hidden" id="xianzkid3" name="xianzkid3">
                <input type="hidden" id="xianzkmc3" name="xianzkmc3">
                <input type="hidden" id="xianzkid4" name="xianzkid4">
                <input type="hidden" id="xianzkmc4" name="xianzkmc4">
                
            </td> 
        </tr>
        
		<tr>
        	<td>
            	买受人（购方）:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<input id="msr" name="maisdwmc" type="text" class="longtextbox" title="请录入至少两个汉字关键字选择买受人(如果未找到请先定制买受人)"/>
            	<input id="msrid" type="hidden" name="maisdwbm">
            	<input id="msrssdwmc" type="hidden" name="maisrssdwmc">
                <input id="msrssdwbm" type="hidden" name="maisrssdwbm">
                <input id="msridwithmc" type="hidden" >
                 <a  href="javascript:NBuilderIM_openChatBox(${toinfo.aouserid});" style="height:50px;"> <img class="NBuilderIMToChat"></a>
            </td>
            <td>签约地点:</td>
            <td><input type="text" name="qianydd" class="longtextbox" value="中国(太原)煤炭交易中心" readonly/></td>
            <td>
                                          到站:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>            	 
            	<input id="daozmc" type="text" name="daozmch" class="longtextbox" onclick="clickDaoz();" readonly="true"/>                
                <input type="hidden" id="daozbm" name="daozbm"> 
                <input type="hidden" id="zyx" name="zhuanyx">
                <input type="hidden" id="zzgid" name="huangzgid">
                <input type="hidden" id="zzgmc" name="huangzgmc">
                <input type="hidden" id="jxgid" name="zhongdgid">
                <input type="hidden" id="jxgmc" name="zhongdgmc">
            </td>            
        </tr>
        
        <tr>
        	<td>
            	合同形式:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<div class="select"><div>
            	
            	<select id="hetxs" name="hetxs" style="width:180px" onchange="changeTabForHtxs(this.value);">
            	  <option value="-1" selected>==请选择==</option>
                  <option value="3">省内铁路</option>
                  <option value="4">铁路出省</option> 
                 </select>
            	
            	</div></div>
                <input type="hidden" id="hetxsname" name="hetxsname" >
            </td>
            <td>
            	价格类型:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<div class="select"><div>
            	
            	<select id="jiaglx" name="jiaglx" style="width:180px" onchange="changeTabForJglx(this.value);">
            	<option value="${toinfo.pricetype}" selected>${toinfo.pricename}</option>
                   <c:forEach var="jglx" items="${jglxList}">
                   <option value="${jglx.diccode}">
                   ${jglx.dicname}
                   </option>
                   </c:forEach>
                 </select> 
            	
            	</div></div>                
                <input type="hidden" id="jiaglxmc" name="jiaglxmc" >
            </td>
            <td>
                                        隶属行业:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>                       
            </td>
            <td>            	 
            	<div class="select"><div>
            	
            	<select id="hangy" name="hangy" style="width:180px" onchange="changeTabForHyls()">
            	<option value="-1" selected>==请选择==</option>
                   <c:forEach var="hy" items="${hyList}">
                   <option value="${hy.diccode}">
                   ${hy.dicname}
                   </option>
                   </c:forEach>
                 </select>            	
            	            	
            	</div></div>
            	<input type="hidden" name="hangylsname" id="hangylsname">
            </td>            
        </tr>
       
       <tr>
        	<td>
            	发货单位:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
                <input id="fahdwmc" name="fahdwmc" type="text" class="longtextbox" title="请录入至少两个汉字关键字选择发货单位" value="${toinfo.bddwmc}"/>
            	<input id="fahdwbm" type="hidden" name="fahdwbm" value="${toinfo.potraderid}">
            </td>
            <td>
            	是否中长期合同:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
                <div class="select"><div>
                <select id="iszcx" name="iszcx" style="width:180px">
            	<option value="-1" selected>==请选择==</option>
                  <option value="1">是</option>
                  <option value="0">否</option> 
                 </select>                
                
                </div></div> 
            </td>
            <td>签订时间:<span style="color: red;font-size:16px;vertical-align:middle;">*</span></td>
            <td><input id="datepicker" type="text" class="textbox" name="qianysj" value="${currentDate}" readonly/></td>
                        
        </tr>
        
       
         <tr>
        	<td>
            	到达省市:<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
             <td>          	 
        	     <select class="form-textbox" style="width: 93px;" onchange="changForCity(this.value)" >
        	            <option value="-1">==请选择==</option>
						<c:forEach var="province" items="${provincelist}">
							<option value="${province.regioncode}" >${province.regionname}</option>
						</c:forEach>
		           </select>
        	       <select id="city" class="form-textbox" style="width: 93px;" name="daodssd" >
        	            <option value="-1" selected>==请选择==</option>
		            </select>
            </td>
           <td></td>
              <td></td>
              <td></td>
              <td></td>          
        </tr>
       
        <tr><td colspan="6" style="padding-top:5px;">一、收货人名称、品种规格、数量、单价 </td></tr>
       <tr>
        	<td colspan="6" style="padding:1px;">
            <table id="changdi" align="center" cellpadding="0" cellspacing="0" class="content_gridview" border="1">
            <thead>
            <tr>
              <th rowspan="3">收货人名称<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>
              <th rowspan="3">品种规格<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>
              <th rowspan="3">质量指标</th>
              <th rowspan="3">价格<br/>(元/吨)<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>
              <th colspan="13">交（提）货时间、煤量（吨）<span style="color: red;font-size:16px;vertical-align:middle;">*</span></th>              
            </tr>
            <tr>
              <th rowspan="2">全年合计<span style="color: red;font-size:16px;vertical-align:middle;">*</span><br><a href="#" onclick="txtzjl_onblur(0);" style="text-decoration:none;cursor: hand"><img src="<s:url value="/resources"/>/images/pinf.gif" border=0 alt="平分" align= "absmiddle" height="18"  width="18"></a>&nbsp;&nbsp;<a href="#" onclick="SetYueZJ(0,0,0);" style="border:0px;text-decoration:none;cursor: hand"><img src="<s:url value="/resources"/>/images/qinl.gif"  border=0 alt="清零" align="absmiddle" height="18"  width="18"></a></th>
              <th colspan="3">一季度</th>
              <th colspan="3">二季度</th>
              <th colspan="3">三季度</th>
              <th colspan="3">四季度</th>
            </tr>
            <tr>
              <th>1</th>
              <th>2</th>
              <th>3</th>
              <th>4</th>
              <th>5</th>
              <th>6</th>
              <th>7</th>
              <th>8</th>
              <th>9</th>
              <th>10</th>
              <th>11</th>
              <th>12</th>
            </tr>
          </thead>
            <tbody>
                <tr>
                    <td>
                    <textarea id="shr0" cols="15" rows="3" name="shouhdwmc" class="textarea" title="请录入至少两个汉字关键字选择收货人">${toinfo.yddwmc}</textarea>                    
                    <input id="shrid0" type="hidden" name="shouhdwbm" value="${toinfo.aotraderid}"/>
                    </td>
                    <td>
                    <textarea id="fh0" cols="12" rows="3" name="pinzgg" class="textarea" readonly="true" onclick="clickPzgg(0);" title="请鼠标点击后操作" >${toinfo.meiz}.${toinfo.pinz}</textarea>                    
                    <input type="hidden" id="mzbm0" name="meizbm" value="${toinfo.meizid}">
                    <input type="hidden" id="mzmc0" name="meiz" value="${toinfo.meiz}">
                    <input type="hidden" id="pzbm0" name="pinzbm" value="${toinfo.pinzid}">
                    <input type="hidden" id="pzmc0" name="pinz" value="${toinfo.pinz}">
                    </td>
                    <td>
                    <textarea id="zlzb0" cols="30" rows="3" class="textarea" name="zhilzb" readonly="true"></textarea>                    
                    <input type="hidden" id="zlzbfz0" name="zhilzbfzbm">
                    <input type="hidden" id="zbAry" name="zb">
                    <input type="hidden" id="ppname" name="pinp">
                    <input type="hidden" id="ppid" name="pinpid">
                    </td>
                    <td><input id="jiag0" type="text" class="shorttextbox" name="jiag"  title="请输入0和3000之间的数" value="<fmt:formatNumber value="${toinfo.toprice}" pattern="###.##"/>" /></td>
                    <td><input id="shul0" type="text" class="textboxs" name="shul" title="请输入一千万吨之内的数" value="<fmt:formatNumber value="${toinfo.toquality}" pattern="###"/>"></td>
                    <td><input id="jan0" type="text" class="shorttextbox1" name="gml1" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="feb0" type="text" class="shorttextbox1" name="gml2" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="mar0" type="text" class="shorttextbox1" name="gml3" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="apr0" type="text" class="shorttextbox1" name="gml4" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="may0" type="text" class="shorttextbox1" name="gml5" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="jun0" type="text" class="shorttextbox1" name="gml6" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="jul0" type="text" class="shorttextbox1" name="gml7" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="aug0" type="text" class="shorttextbox1" name="gml8" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="sep0" type="text" class="shorttextbox1" name="gml9" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="oct0" type="text" class="shorttextbox1" name="gml10" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="nov0" type="text" class="shorttextbox1" name="gml11" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>
                    <td><input id="dec0" type="text" class="shorttextbox1" name="gml12" readonly onkeypress="if( event.keyCode == 13 ) {txtyuesl_onblur(0);}" onKeyUp="this.value=this.value.replace(/\D/g,'');"></td>                    
                </tr> 
            </tbody>
            </table>
            </td>
        </tr>
        <tr>
        	
            <td >
                                        条款模板:
            </td>
            <td colspan="5">            	 
            	<div class="select"><div>            	
            	<select style="width:180px" onchange="changeTabForHttk(this.value)" name="tkbm">
            	
                   <c:forEach var="mb" items="${mbtk}">
                   <option value="${mb.id}">
                   ${mb.name}
                   </option>
                   </c:forEach>
                 </select>
            	
            	</div></div>
            </td>            
        </tr>
        <tr>
        	<td colspan="6">
        	<table id="httk" cellpadding="0" cellspacing="0" border="0" class="content1">
        	</table>
        	<input type="hidden" id="tkjson" name="tkjson">
        	</td>
        </tr>
        <tr>
        <td colspan="6">
        <table  cellpadding="0" cellspacing="0" style="width:100%" class="content_gridview" border="1">
        <thead>        
            <tr>                
                <th colspan="2">出卖人(销方)</th>
                <th colspan="2">买受人（购方）</th>                
            </tr>
        </thead>
        <tbody>
            <tr>
                <td>
<table id="sjsdnr" cellpadding="0" cellspacing="0" border="0" class="content1" >
       <tr>
        	<td> 
            	出卖人名称：
            </td>
            <td>
            	<input type="text" class="longtextbox" id="qiymc" /> 
            </td>           
        </tr>
       
        <tr>
        	<td> 
            	住 所: 
            </td>
            <td>
            	<input id="chumdwdz" type="text" name="chumdwdz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	法定代表人: 
            </td>
            <td>
            	<input id="chumdwfddbr" type="text" name="chumdwfddbr" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	委托代理人: 
            </td>
            <td>
            	<input id="chumdwwtdlr" type="text" name="chumdwwtdlr" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	电 话: 
            </td>
            <td>
            	<input id="chumdwdh" type="text" name="chumdwdh" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	传真: 
            </td>
            <td>
            	<input id="chumdwcz" type="text" name="chumdwcz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	邮政编码: 
            </td>
            <td>
            	<input id="chumdwyzbm" type="text" name="chumdwyzbm" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	开户银行: 
            </td>
            <td>
            	<input id="chumdwkhyh" type="text" name="chumdwkhyh" class="longtextbox" /> 
            </td>           
        </tr>        
        <tr>
        	<td> 
            	帐号: 
            </td>
            <td>
            	<input id="chumdwzh" type="text" name="chumdwzh" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	纳税人登记号: 
            </td>
            <td>
            	<input id="chumdwnsrdjh" type="text" name="chumdwnsrdjh" class="longtextbox" /> 
            </td>           
        </tr>
       
</table>
</td>
                <td><table id="sjsdnr1" cellpadding="0" cellspacing="0" border="0" class="content1" >
       <tr>
        	<td> 
            	出卖人结算单位名称：<span style="color: red;font-size:16px;vertical-align:middle;">*</span>
            </td>
            <td>
            	<div class="select"><div>
            	<select style="width:180px" id="chumdwjsrbm" name="chumdwjsrbm" onchange="changeTabForJsdw(this.value,'1')">            	
                </select>            	
            	
            	</div></div>
                <input id="cmdwjsrmc" type="hidden" name="chumdwjsrmc" value="${jydw.qiyqc}">
            </td>           
        </tr>
        
        <tr>
        	<td> 
            	住 所: 
            </td>
            <td>
            	<input id="szs" type="text" name="chumdwjsrdz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	法定代表人: 
            </td>
            <td>
            	<input id="sfddbr" type="text" name="chumdwjsrfddbr" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	委托代理人: 
            </td>
            <td>
            	<input id="swtdlr" type="text" name="chumdwjsrwtdlr" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	电 话: 
            </td>
            <td>
            	<input id="sdh" type="text" name="chumdwjsrdh" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	传真: 
            </td>
            <td>
            	<input id="scz" type="text" name="chumdwjsrcz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	邮政编码: 
            </td>
            <td>
            	<input id="syb" type="text" name="chumdwjsryzbm" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	开户银行: 
            </td>
            <td>
            	<input id="skhyh" type="text" name="chumdwjsrkhyh" class="longtextbox" /> 
            </td>           
        </tr>        
        <tr>
        	<td> 
            	帐号: 
            </td>
            <td>
            	<input id="szh" type="text" name="chumdwjsrzh" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	纳税人登记号: 
            </td>
            <td>
            	<input id="sdjh" type="text" name="chumdwjsrnsrdjh" class="longtextbox" /> 
            </td>           
        </tr>
        
</table></td>
                <td><table id="bjsdnr" cellpadding="0" cellspacing="0" border="0" class="content1" >
       <tr>
        	<td>  
            	买受人名称： 
            </td>
            <td>
            	<input  id="maisr" name="maisr" type="text"  class="longtextbox" readonly/> 
            </td>           
        </tr>
       
        <tr>
        	<td> 
            	住 所: 
            </td>
            <td>
            	<input id="zs" type="text" name="maisdwdz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	法定代表人: 
            </td>
            <td>
            	<input id="fddbr" type="text" name="maisdwfddbr" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	委托代理人: 
            </td>
            <td>
            	<input id="wtdlr" type="text" name="maisdwwtdlr" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	电 话: 
            </td>
            <td>
            	<input id="dh" type="text" name="maisdwdh" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	传真: 
            </td>
            <td>
            	<input id="cz" type="text" name="maisdwcz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	邮政编码: 
            </td>
            <td>
            	<input id="yb" type="text" name="maisdwyzbm" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	开户银行: 
            </td>
            <td>
            	<input id="khyh" type="text" name="maisdwkhyh" class="longtextbox" /> 
            </td>           
        </tr>        
        <tr>
        	<td> 
            	帐号: 
            </td>
            <td>
            	<input id="zh" type="text" name="maisdwzh" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	纳税人登记号: 
            </td>
            <td>
            	<input id="djh" type="text" name="maisdwnsrdjh" class="longtextbox" /> 
            </td>           
        </tr>
       
</table></td>
                <td><table id="bjsdnr1" cellpadding="0" cellspacing="0" border="0" class="content1" >
       <tr>
        	<td>  
            	买受人结算单位名称：<span style="color: red;font-size:16px;vertical-align:middle;">*</span> 
            </td>
            <td>            	
                <div class="select"><div>
            	<select style="width:180px;" id="maisdwjsrbm" name="maisdwjsrbm" style="width:100px;" onchange="changeTabForJsdw(this.value,'0')" ></select>            	
            	</div></div>
                <input id="msdwjsrmc" type="hidden" name="maisdwjsrmc">
            </td>           
        </tr>
        
        <tr>
        	<td> 
            	住 所: 
            </td>
            <td>
            	<input id="bzs" type="text" name="maisdwjsrdz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	法定代表人: 
            </td>
            <td>
            	<input id="bfddbr" type="text" name="maisdwjsrfddbr" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	委托代理人: 
            </td>
            <td>
            	<input id="bwtdlr" type="text" name="maisdwjsrwtdlr" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	电 话: 
            </td>
            <td>
            	<input id="bdh" type="text" name="maisdwjsrdh" class="longtextbox" /> 
            </td>           
        </tr>
         <tr>
        	<td> 
            	传真: 
            </td>
            <td>
            	<input id="bcz" type="text" name="maisdwjsrcz" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	邮政编码: 
            </td>
            <td>
            	<input id="byb" type="text" name="maisdwjsryzbm" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	开户银行: 
            </td>
            <td>
            	<input id="bkhyh" type="text" name="maisdwjsrkhyh" class="longtextbox" /> 
            </td>           
        </tr>        
        <tr>
        	<td> 
            	帐号: 
            </td>
            <td>
            	<input id="bzh" type="text" name="maisdwjsrzh" class="longtextbox" /> 
            </td>           
        </tr>
        <tr>
        	<td> 
            	纳税人登记号: 
            </td>
            <td>
            	<input id="bdjh" type="text" name="maisdwjsrnsrdjh" class="longtextbox" /> 
            </td>           
        </tr>
       
</table></td>				
            </tr>
        </tbody>
    </table>
        
        
        </td>
        
        </tr>
        <tr>
					<td colspan="4"><font size="2" color="#FF0000"></font></td>
					<td align="right">        
                      <font size="2" >年度：</font>
                      <select style="width:70px;" id="nianf" name="nianf" onchange="changeTabForYxq(this.value)" >
            	         <!--  <option value="2013">2013年</option>
            	         <option value="2014" >2014年</option>-->
            	         <option value="2015" selected>2015年</option>
            	         <option value="2016">2016年</option>
            	      </select> 
                              
                    </td>
					<td align="left">					
					<font size="2">合同有效期：<input id="kssj" type="text" name="youxqxkssj" class="textbox" value="${currentDate}" readonly/> 至<input id="jssj" type="text" class="textbox" name="youxqxjssj" value="${endDate}" readonly/></font></td>
        <input type="hidden" id="cDate" value="${currentDate}">
        <input type="hidden" id="eDate" value="${endDate}">
				</tr>       
        <tr>
		    <td colspan="6" align="center">	
		   
		    <input id="but1" type="button" name="" value="保存" />&nbsp;&nbsp;&nbsp;
		    <input id="but2" type="button" name="" value="提报至买方" />&nbsp;&nbsp;&nbsp;
		    <input id="but3" type="button" name="" value="关闭" onclick="window.returnValue=1;window.close();"/></td>            
        </tr>
        <tr>
        <td></td>
        <td></td>
		    <td colspan="2" align="left">	
		   1、卖方起草合同并点击保存后，可与对方发起在线协商。<br/>
           2、对方通过“合同确认”后打开协商窗口，通过刷新页面可以实时查看起草的合同信息。<br/>
           3、协商一致后，卖方提交合同，并通过“电子合同-电子签章”进行电子签章。<br/>
           4、买方确认合同，并通过“电子合同-电子签章”进行电子签章。<br/>
           5、交易中心确认合同，系统自动归档合同。
		   </td>
		   <td></td>
		   <td></td>            
        </tr>
  </table> 
  <input type="hidden" name="dongzlx" value="3"> 
  <input type="hidden" name="dongzbm" value="20">   
</form>
 
</div> 
	
<script src="http://10.1.22.223:8020/js/sea.js"></script>
	<script>
	var pouserid=document.getElementById("pouserid").value;
	var pousername=document.getElementById("pousername").value;
	var authtoken=document.getElementById("authtoken").value;
        var NBuilder_IMconfig = {
            server: "http://10.1.22.223:8020",
            user: {
                id: pouserid,//当前用户id
                name: pousername,//当前用户姓名
                face: "http://10.1.22.223:8021/DownloadFile.ashx?file=CTCTCECP\20150608\160543zb.jpg"//头像
            },
            token:authtoken
        };
        
            seajs.use(NBuilder_IMconfig.server + "/js/im/im", function () {
                $(".NBuilderIMToChat").attr("src", NBuilder_IMconfig.server + "/image/imonline.png").css("border", "none");

                /*启动后自动打开聊天窗口
                //var touserid=2
                //NBuilderIM_openChatBox(touserid);
                */

            });  
    </script>

<div id="dialog-confirm" title="是否确认提交？"></div>

  </body>
</html>

